<ol class="breadcrumb">
    <li><a href="#">奇妙云箱</a></li>
    <li>奖品管理</li>
</ol>
<div class="panel panel-default">
    <div class="panel-heading">
        <span class="glyphicon glyphicon-list"></span>
        <span class="panel-title">奖品列表</span>
        <% if(session.permissionMap[1012]){ %>
        <a href="/prize/create" class="pull-right btn btn-success btn-sm" style="margin-top: -3px;">
            <span class="glyphicon glyphicon-plus"></span>
            <span>新增</span>
        </a>
        <% } %>
    </div>
    <div class="table-responsive">
        <table class="table table-hover table-striped">
            <thead>
            <tr>
                <th>商品ID</th>
                <th>商品名称</th>
                <th>商品价格</th>
                <th>商品图片</th>
                <th>操作</th>
            </tr>
            </thead>
            <tfoot>
            <tr>
                <td colspan="7">
                    <nav class="twbsPagination"></nav>
                </td>
            </tr>
            </tfoot>
            <tbody>
            <% for(var i = 0;i < datas.length;i++){ %>
            <tr>
                <td><a
                            href="/box_management/prize_order?list=<%= datas[i]._id %>"><%= datas[i]._id %></a></td>
                <td><%= datas[i].name %></td>
                <td><%= datas[i].price %></td>
                <td><img src="<%= datas[i].imgurl %>"
                                                              style="width: 50px;height: 50px;"></td>
                <td>
                    <% if(session.permissionMap[1014]){ %>
                    <a class="btn btn-default btn-sm" href="/prize/edit?list=<%= datas[i]._id %>">编辑</a>
                    <% } %>
                    <% if(session.permissionMap[1013]){ %>
                    <a class="btn btn-danger btn-sm" href="/box_management/remove_prize?list=<%= datas[i]._id %>" onclick="return confirm('确定删除该商品?')" >删除</a>
                    <% } %>
                </td>
            </tr>
            <% } %>
        </table>
    </div>
</div>


<script type="text/javascript">
    $(function () {
        //分页功能
        $('.twbsPagination').twbsPagination({
            totalPages: <%= page.pageCount %>,
            visiblePages: 10,
            href: '/prize/list?num={{number}}'
        });
    })
</script>